import { NgModule } from '@angular/core';
import { RequestOptions, JsonpModule, JSONPBackend } from '@angular/http';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { IonicStorageModule } from '@ionic/storage';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';


import { Clipboard } from '@ionic-native/clipboard';
import { Network } from '@ionic-native/network/ngx';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
// 引入service
import { TabsService } from './core/tabs.service';
import { HttpService } from './service/http.service';
import { ConfigService } from './service/config.service';
import { ToolService } from './service/tool.service';
import { UrlService } from './service/url.service';
import { PopwinService } from './service/popwin.service';
import { EventService } from './service/event.service';
import { StorageService } from './service/storage.service';
import { ThemeService } from './service/theme.service';
// 自定义的组件
import { CommonComponentsModule } from './component/common-components.module';
import { MobileAccessibility } from '@ionic-native/mobile-accessibility/ngx';
import { SharedPipeModule } from './pipes/shared.pipe.module';


import { FileTransfer } from '@ionic-native/file-transfer/ngx';
import { File } from '@ionic-native/file/ngx';
import { FileOpener } from '@ionic-native/file-opener/ngx';
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';


@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [BrowserModule, IonicModule.forRoot({
    mode:'ios',//所有的样式都统一为ios
    backButtonText: ''//配置放回按钮
  }), AppRoutingModule, JsonpModule, IonicStorageModule.forRoot(),FormsModule, ReactiveFormsModule,CommonComponentsModule,SharedPipeModule],
  providers: [
    StatusBar,
    SplashScreen,
    TabsService,
    Network,
    // Clipboard,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
    {
      provide: HttpService,
      useFactory: (jsonpBackend: JSONPBackend, requestOptions: RequestOptions) => {
        return new HttpService(jsonpBackend, requestOptions);
      },
      deps: [JSONPBackend, RequestOptions]
    },
    ConfigService,
    ToolService,
    UrlService,
    PopwinService,
    EventService,
    StorageService,
    ThemeService,
    MobileAccessibility,
    FileTransfer,File,FileOpener,InAppBrowser
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
